package com.hwz.controller.user;

import com.hwz.entity.Dish;
import com.hwz.result.Result;
import com.hwz.service.DishService;
import com.hwz.vo.DishVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.processing.SupportedSourceVersion;
import java.util.List;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Lenovo]
 * @version : [v1.0]
 * @createTime : [2024/3/18 17:00]
 */
@RestController("UserDishController")
@RequestMapping("/user/dish")
@Slf4j
public class DishController {
    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    @Cacheable(cacheNames = "dish",key = "#categoryId")
    public Result<List<DishVO>> list(Long categoryId){
        return Result.success(dishService.list(categoryId));
    }
}
